package com.ruoyi.swla2.service.impl;

import java.util.Arrays;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.swla2.mapper.MeterHistoryDataMapper;
import com.ruoyi.swla2.domain.MeterHistoryData;
import com.ruoyi.swla2.service.IMeterHistoryDataService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import org.springframework.transaction.annotation.Transactional;
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
/**
 * 远传小-历史数据Service业务层处理
 * 
 * @author gdqt
 * @date 2025-04-16
 */
@Service
public class MeterHistoryDataServiceImpl extends ServiceImpl<MeterHistoryDataMapper, MeterHistoryData> implements IMeterHistoryDataService
{
    @Autowired
    private MeterHistoryDataMapper meterHistoryDataMapper;

    /**
     * 查询远传小-历史数据列表
     * 
     * @param meterHistoryData 远传小-历史数据
     * @return 远传小-历史数据
     */
    @Override
    public List<MeterHistoryData> selectMeterHistoryDataList(MeterHistoryData meterHistoryData)
    {
        LambdaQueryWrapper<MeterHistoryData> queryWrapper = new LambdaQueryWrapper<>();
        if(StringUtils.isEmpty(meterHistoryData.getTenantId())){
            queryWrapper.eq(MeterHistoryData::getTenantId,meterHistoryData.getTenantId());
        }
        if(meterHistoryData.getTotalFlow() != null){
            queryWrapper.eq(MeterHistoryData::getTotalFlow,meterHistoryData.getTotalFlow());
        }
        if(meterHistoryData.getTerminalVol() != null){
            queryWrapper.eq(MeterHistoryData::getTerminalVol,meterHistoryData.getTerminalVol());
        }
        if(meterHistoryData.getCreateDate() != null){
            queryWrapper.eq(MeterHistoryData::getCreateDate,meterHistoryData.getCreateDate());
        }
        if(meterHistoryData.getID() != null){
            queryWrapper.eq(MeterHistoryData::getID,meterHistoryData.getID());
        }
        return meterHistoryDataMapper.selectList(queryWrapper);
    }

    /**
     * 新增远传小-历史数据
     * 
     * @param meterHistoryData 远传小-历史数据
     * @return 结果
     */
    @Override
    public int insertMeterHistoryData(MeterHistoryData meterHistoryData)
    {
        return meterHistoryDataMapper.insert(meterHistoryData);
    }
}
